// pages/Seek_pets_inf/Seek_pets_inf.js
var call = require("../../utils/ajax.js")
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    URL: "",
    imgUrls: [
      '../../images/dog.jpg',
      '../../images/dog.jpg',
      '../../images/dog.jpg'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 500,
    petM: {},
    petID:"",
    admin:"",
    state:false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
            this.setData({
                  URL:app.globalData.URL
              })
    var admin = this;
    console.log(options);
    let id = options.id;
    call.getData1("SearchPet/selectOneSearchPet/" + id, function(e) {
        if (e.success) {
            admin.setData({
                petM: e.date,
                petID:id
            });
        }

        console.log(e)
    }, function() {
        console.log("aa")
    })
  },
  linkH:function (e){
    let that = this;
    let address = that.data.petM.lose_city_area+that.data.petM.lose_county_area+that.data.petM.lose_detailed_area;
    let message = {
      phone:that.data.petM.publisher_phone,
      weixin:"暂无",
      adress:address
    }
    console.log(message)
    that.setData({
      admin:message,
      state:true
    })
  },
  onClose:function (e) {
    console.log(e)
    this.setData({
      state:false
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  goTop:function (res) {
    var that = this;
    console.log(that.data.petID)
    wx.navigateTo({
       url: '/pages/poster/poster?id='+that.data.petID
       })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})